//
//  UIBarButtonItem+Category.swift
//  Weibo
//
//  Created by zxy on 2018/11/30.
//  Copyright © 2018 zxy. All rights reserved.
//

import Foundation
extension UIBarButtonItem {
    //class:在方法前面加class相当于oc中的类方法+
    class func setupNavigationItem(imageName: String,target: Any?,action: Selector) -> UIBarButtonItem{
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), for: .normal)
        btn.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        btn.sizeToFit()
        btn.addTarget(target, action: action, for: .touchUpInside)
        return UIBarButtonItem(customView: btn)
    }
}
